Import('APP_ROOT')
from building import *

cwd = GetCurrentDir()
src	= Glob('*.c')

CPPPATH = [cwd, str(Dir('#'))]

SrcRemove(src, 'application.c')
objs = DefineGroup('startup', src, depend = [''], CPPPATH = CPPPATH)


Return('objs')

if os.path.normpath(APP_ROOT) == cwd:
    objs = DefineGroup('applications', src, depend = [''], CPPPATH = CPPPATH)
else:
    # remove no need file.
    SrcRemove(src, 'application.c')
    objs = DefineGroup('startup', src, depend = [''], CPPPATH = CPPPATH)
    if os.path.isfile(os.path.join(APP_ROOT, 'SConscript')):
        objs += SConscript(os.path.join(APP_ROOT, 'SConscript'),
				variant_dir='build/applications',
				duplicate=0)
Return('objs')
